//
//  RealTimeTrainModel.h
//  CoolTennisBall
//
//  Created by Coollang on 16/7/29.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

#import <Foundation/Foundation.h>


@class ChartItem;
@interface RealTimeTrainModel : NSObject<NSCoding>

/** 训练类型 */
@property (nonatomic, assign)RealTimeTrainType trainTyep;


@property long long startRealTimeStamp;          // 训练开始时间
@property long long endRealTimeStamp;            // 训练结束时间


#pragma mark - 目标值
@property (nonatomic, strong)NSNumber *frontHandShangXuanTarget;
@property (nonatomic, strong)NSNumber *frontHandPingJiTarget;
@property (nonatomic, strong)NSNumber *frontHandXueQiuTarget;
@property (nonatomic, strong)NSNumber *frontHandPaiSuTargetSpeed;

@property (nonatomic, strong)NSNumber *backHandShangXuanTarget;
@property (nonatomic, strong)NSNumber *backHandPingJiTarget;
@property (nonatomic, strong)NSNumber *backHandXueQiuTarget;
@property (nonatomic, strong)NSNumber *backHandPaiSuTargetSpeed;
// 发球目标值
@property (nonatomic, assign)CGFloat faQiuTargetSpeed;

/** 计算完成度 [0,1] 用于计算正反手完成度 */
@property (nonatomic, assign)CGFloat Frequency;

/** 上传数据的时间戳 */
@property (nonatomic, copy)NSString *UploadTime;
/** 上传ID -- 用来删除数据 */
@property (nonatomic, copy)NSString *ID;


// 发球平均值
@property (nonatomic, assign)CGFloat faQiuAverageSpeed;

/** 每次训练的挥拍详情数组 */
@property (nonatomic, strong) NSMutableArray <ChartItem *> *chartItemArray;

- (NSString *)monthAndDay;
- (NSString *)yearAndMonthAndDay;
- (NSDate *)date;
- (NSString *)hourAndMinute;
// 训练时长
- (NSString *)trainTimeLong;

// 计算发球训练的平均值
- (CGFloat )averageValue;

/**
 *  计算正反手训练的数据
 *
 *  @return 返回值中第一个是正手对应的数据 第二个是反手对应的数据
 */
- (void)disposeForeHandData:(void(^)(NSDictionary *foreHandData))foreHand  BackHandData:(void(^)(NSDictionary *backHandData))backhand;

// 计算完成度-- 在停止训练，即将保存数据的时候调用此方法，不然Frequency没值，网络请求的不用调用
- (void)calculateCopleteSituation;

- (instancetype)initWithGetNetLoadDataDict:(NSDictionary *)dict trainType:(RealTimeTrainType)type;

UIKIT_EXTERN NSString * const ForeHandHitBallNumber;
UIKIT_EXTERN NSString * const ForeHandaverageSpeed;

UIKIT_EXTERN NSString * const BackHandHitBallNumber;
UIKIT_EXTERN NSString * const BackHandaverageSpeed;


@end
